import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
        int[] array = {1,2,7,5,6,4};
        int[] ret = array.clone();
//        int[] ret = new int[array.length];
//        System.arraycopy(array,0,ret,0,array.length);
//        int[] ret = Arrays.copyOfRange(array,1,3);
//        int[] ret = copy(array);
//        int[] ret = Arrays.copyOf(array,array.length*2);
//        transform(array);
//        reverse(array);
        System.out.println(Arrays.toString(ret));


//        int[] array = new int[10];
//        Arrays.fill(array,2);
//        System.out.println(Arrays.toString(array));

//        Arrays.sort(array);
//        System.out.println(isSorted(array));
//        bubbleSort(array);
//        System.out.println(Arrays.toString(array));

    }
    public static int[] copy(int[] array){
        int[] ret = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            ret[i] = array[i];
        }
        return ret;
    }

    public static void transform(int[] array){
        int i = 0;
        int j = array.length-1;
        while (i < j){
            while (i < j && array[i] % 2 == 0){
                i++;
            }
            while (i < j && array[j] % 2 != 0){
                j--;
            }
            int tmp = array[i];
            array[i] = array[j];
            array[j] = tmp;
        }
    }
    public static void reverse(int[] array){
        int i = 0;
        int j = array.length-1;
//        for (int i = 0; i < array.length; i++) {
//            for (int j = array.length-1; j > 0; j--) {
                while (i < j){
                    int tmp = array[i];
                    array[i] = array[j];
                    array[j] = tmp;
                    i++;
                    j--;
                }
//            }
        }

    public static void bubbleSort(int[] arr){
//        for (int i = 0; i < arr.length-1; i++) {
//            boolean flg = false;
//            for (int j = 0; j < arr.length-1-i; j++) {
//                if (arr[j] > arr[j+1]){
//                    int tmp = arr[j];
//                    arr[j] = arr[j+1];
//                    arr[j+1] = tmp;
//                    flg = true;
//                }
//
//            }
//            if (flg == false){
//                return;
//            }
//        }
        for (int i = 0; i < arr.length-1; i++) {
            boolean flg = false;
            for (int j = 0; j < arr.length-1-i; j++) {
                if (arr[j] > arr[j+1]){
                    int tmp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = tmp;
                    flg = true;
                }
            }
            if (flg == false){
                return;
            }

        }
    }
    public static boolean isSorted(int[] arr){
        for (int i = 0; i < arr.length-1; i++) {
            if (arr[i] > arr[i+1]){
                return false;
            }
        }
        return true;
    }
}
